how to solve complimentary function